﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Reports.Customer
{
    public class Report2 : DependencyObject
    {
        public static DependencyProperty TopProperty = DependencyProperty.Register("Top", typeof(int), typeof(Report2));
        public int Top
        {
            get { return (int)GetValue(TopProperty); }
            set
            {
                SetValue(TopProperty, value);
            }
        }
        public Report2()
        {
            Top = 5;
        }
        public CrystalReport2 Load(TinyCinema.Bussiness.Login.Employee LoginInfo)
        {
            string sql = "select Top " + Top + " KHACHHANG.TenKH, KHACHHANG.GioiTinh,KHACHHANG.NgaySinh, KHACHHANG.DienThoai, KHACHHANG.Diem, LOAIKHACHHANG.TenLKH" +
                         " from KHACHHANG,LOAIKHACHHANG" +
                         " where KHACHHANG.MaLKH=LOAIKHACHHANG.MaLKH AND KHACHHANG.Diem>=0" +
                         " order by KHACHHANG.DIEM desc";
            CrystalReport2 report = new CrystalReport2();
            report.SetDataSource(TinyCinema.Data.Execution.Excute(sql));
            report.SetParameterValue("EmployeeName", LoginInfo.Emp.Name);
            report.SetParameterValue("Top", Top);
            return report;
        }
    }
}
